(define (smallest-divisor n)
        (find-divisor n 2)
)
(define (find-divisor n test-divisor)
        (cond ((> (* test-divisor test-divisor) n) n)
            ((dividers? test-divisor n) test-divisor)
            (else (find-divisor n (+ test-divisor 1)))
        )
)
(define (dividers? a b)
        (= (remainder b a) 0)
)
(define (prime? n)
    (= n (smallest-divisor n))
)


(define (search-for-primes n)
    (if (prime? n)
        n
        (search-for-primes (+ 1 n))
    )
)

; (display (search-for-primes 1000000))

(time 
    (search-for-primes 1000000000)
)


(exit)